package com.tanhua.app.controller;

import com.tanhua.app.service.BaiduService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class BaiduController {

    @Autowired
    private BaiduService baiduService;

    @PostMapping(value = "/baidu/location", name = "上传地理位置")
    public ResponseEntity uploadLocation(@RequestBody Map<String, Object> param) {
        Double latitude = (Double) param.get("latitude");
        Double longitude = (Double) param.get("longitude");
        String address = (String) param.get("addrStr");

        return baiduService.uploadLocation(latitude,longitude,address);
    }

}
